using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class ReferalMap : EntityTypeConfiguration<Referal>
    {
        public ReferalMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.NAME)
                .HasMaxLength(41);

            this.Property(t => t.REV_NAME)
                .HasMaxLength(41);

            this.Property(t => t.FIRST_NM)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.LAST_NM)
                .HasMaxLength(20);

            this.Property(t => t.SALUTATION)
                .HasMaxLength(15);

            this.Property(t => t.LICENSE_NO)
                .HasMaxLength(15);

            this.Property(t => t.ADDRESS)
                .HasMaxLength(200);

            this.Property(t => t.CITY)
                .HasMaxLength(30);

            this.Property(t => t.ZIP)
                .HasMaxLength(12);

            this.Property(t => t.PHONE)
                .HasMaxLength(19);

            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("Referals");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.NAME).HasColumnName("NAME");
            this.Property(t => t.REV_NAME).HasColumnName("REV_NAME");
            this.Property(t => t.FIRST_NM).HasColumnName("FIRST_NM");
            this.Property(t => t.LAST_NM).HasColumnName("LAST_NM");
            this.Property(t => t.SALUTATION).HasColumnName("SALUTATION");
            this.Property(t => t.LICENSE_NO).HasColumnName("LICENSE_NO");
            this.Property(t => t.BDATE).HasColumnName("BDATE");
            this.Property(t => t.ADDRESS).HasColumnName("ADDRESS");
            this.Property(t => t.CITY).HasColumnName("CITY");
            this.Property(t => t.ZIP).HasColumnName("ZIP");
            this.Property(t => t.PHONE).HasColumnName("PHONE");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");
            this.Property(t => t.Notes).HasColumnName("Notes");
            this.Property(t => t.FeesPlan).HasColumnName("FeesPlan");
        }
    }
}
